/*! 
 * WeX5 v3 (http://www.justep.com) 
 * Copyright 2015 Justep, Inc.
 * Licensed under Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) 
 */
define(function(require) {
	var $ = require("jquery");
	var justep = require("$UI/system/lib/justep");
	var BizDesignComp = require("$UI/system/components/designerCommon/comp/bizDesignComp");
	require('css!./css/wxRefund').load();

	function create(comp, clz) {
		var $domNode = $(comp.domNode);
		comp.domNode.style.position = "absolute";
		if (!comp.domNode.style.top) {
			comp.domNode.style.top = "10px";
			comp.domNode.style.left = "10px";
		}
		$domNode.addClass(clz).html('');
	}
	var wxRefundDesigner = BizDesignComp.extend({
		// 构造函数
		constructor: function(config) {
			this.callParent(config);
		},

		// 初始化
		init: function(value, bindingContext) {
			create(this, 'x-wxRefund');
			this.callParent(value, bindingContext);
		}

	});

	justep.Component.addOperations(wxRefundDesigner, {
		'sendRefund': {
			label: '发起退款',
			argsDef: [],
			method: function(args) {}
		}
	});

	var quickIdeEx = {
		"$UI/comp/wxAppPay/components/wxRefund/wxRefund": {
			properties: ['xid','refundType', 'outTradeNoExpr', 'outRefundNoExpr', 'totalFeeExpr', 'refundFeeExpr', 'appidExpr'],
			events: [{
				name: "onRefundBefore",
				text: "退款前事件",
				editor: "eventEditor",
				noLabel: true
			}, {
				name: "onRefundSuccess",
				text: "退款成功事件",
				editor: "eventEditor",
				noLabel: true
			}, {
				name: "onRefundFail",
				text: "退款失败事件",
				editor: "eventEditor",
				noLabel: true
			}],
			operations: function() {
				return [{
					groupName: "微信退款",
					items: [{
						name: 'sendRefund',
						label: "发起退款",
						argExtends: {}
					}]
				}];
			},
			displayName: function(config) {
				return "微信退款";
			}
		}
	};

	return {
		'$UI/comp/wxAppPay/components/wxRefund/wxRefund': wxRefundDesigner,
		quickIdeEx: quickIdeEx
	};
});